﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
    <div class="site_map" align="left">Trang chu <img src="/onlinemarket/img/navbit-arrow-right.png"/> Hoa don</div>
    <div class="heading">
        <div class="heading_left"></div>
        <div class="heading_right"></div>
        <div class="heading_center">
        	<h3>Hoa don</h3>
        </div>
         <div class="table">
            <h1>&nbsp;</h1>
            <form method="post" style=""  enctype="multipart/form-data" id="Order" name="Order" action="/onlinemarket/orders/save">
                <table style="padding-left: 50px;">
                <tr>
                    <td>
                        <table>
                            <input type="hidden" id="id" name="id" value="<?php echo($orderread['Order']['id']); ?>"/>
              
                            <tr>
                                <td><font color="red">*</font>Mô tả hóa đơn</td>
                                <td><textarea name="description" id="description" rows="5" cols="22"><?php echo($orderread['Order']['description']); ?></textarea></td>
                            </tr>
                            <tr>
							<td>Status</td>
							<td><input name="status" type="checkbox"  checked value=1 /></td>
							</tr>
							<tr>
	                             <td>Khách hàng</td>
                                <td>
								<select name="custommer_id" style="width:200;text-align:center">
								<?php foreach($customers as $customer){ ?>
								 <option value="<?php echo($customer['Customer']['id']); ?>"><?php echo($customer['Customer']['username']);  ?> </option>
								  <?php } ?>
								 </select>
								</td>
                            </tr>
							<tr>
							<td>Phương thức thanh toán</td>
							<td>
								<select name="paymethod_id" style="width:200;text-align:center">
								<?php foreach($paymethods as $paymethod){ ?>
								 <option value="<?php echo($paymethod['Paymethod']['id']); ?>" ><?php echo($paymethod['Paymethod']['name']);  ?> </option>
								  <?php } ?>
								 </select>
								</td>
							</tr>
                            <tr>
                                <td colspan="5" align="right">
                                    <input type="submit" value="Luu" style="height: 25px; padding-top: 0.3em; font-size: 12px;"/>
                   					<input type="button" value="H?y" style="height: 25px; padding-top: 0.3em; font-size: 12px;" onclick="onCancel();"/>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="padding-bottom: 0;"><hr /></td>
                </tr>
                <tr>
                    <td colspan="2" style="padding-top: 0;">Trường <font color="red">*</font> yêu cầu phải nhập</td>
                </tr>
                </table>
            </form>
            </div>
            <!-- hien thi chi thông tin hóa đơn-->
<table class="border" style="width: 100%;">
    <tr>
        <td colspan="10" align="right"><a href="/onlinemarket/orders">Thêm hóa đơn mới</a></td>
    </tr>
    <tr>
        <th>Khách hàng</th>
        <th>Ngày</th>
        <th>Thanh toán</th>
        <th>Mô tả</th>
        <th>Trạng Thái</th>
		<th>Chức năng</th>
    </tr>


<?php foreach ($allorder as $oder) { ?>
<tr>
   <?php foreach($customers as $customer){
								if($customer['Customer']['id']==$oder['Order']['customer_id']){ ?>
    <td align="center"><?php echo($customer['Customer']['lastname']); echo(" ".$customer['Customer']['firstname']); } } ?>&nbsp;</td>
    <td align="left"><?php echo($oder['Order']['date']); ?>&nbsp;</td>
   <?php foreach($paymethods as $paymethod){
								if($paymethod['Paymethod']['id']==$oder['Order']['paymethod_id']){ ?>
    <td align="center"><?php echo($paymethod['Paymethod']['name']); } } ?>&nbsp;</td>
	<td align="center"><?php echo($oder['Order']['description']); ?>&nbsp;</td>
	 <td align="center"><?php echo($oder['Order']['status']); ?>&nbsp;</td>
	 
	<td align="center">
        <img style="cursor: pointer;" src="/onlinemarket/img/system/bt_edit.png" onclick="onEdit('/onlinemarket/orders/index/<?php echo($oder['Order']['id']);?>')" alt="Sủa" title="Sửa"/>
        <img style="cursor: pointer;" src="/onlinemarket/img/system/bt_delete.png" onclick="onEdit('/onlinemarket/orders/delete/?id=<?php echo($oder['Order']['id']);?>')" alt="xóa" title="xóa"/>
		 <img style="cursor: pointer;" src="/onlinemarket/img/system/view.bmp" onclick="onEdit('/onlinemarket/orders/view/?id=<?php echo($oder['Order']['id']);?>')" alt="xem" title="xem"/>
    </td>
</tr>
<?php } ?>

</table>
</div>
<script>
function onEdit(link) {
        window.location = link;
    }
    function onCancel() {
        $('form').slideUp('slow');
    }
</script>

</body>
</html>